<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
    <script type="text/javascript" src="../static/js/jquery-3.3.1.min.js"></script>
    <style>
        /*鼠标放上小手标志*/
        font {
            cursor: pointer;
        }
    </style>
</head>
<body>

<div style="width: 100%;background-color: whitesmoke; height: 100%; display: block;position: fixed;top:1%; left: 3%;z-index: inherit"
     id="boxDiv2">
    <form onsubmit="return false">
        <table border="0" bgcolor="whitesmoke" cellspacing="0" align="center" width="500" height="400">
            <caption  style="font-size: 50px">添加项目</caption>
            <tr>
                <td>项目标题</td>
                <td colspan="5"><input class="layui-layer-input" type="text" id="addcircular_title" placeholder="请输入项目标题" style="width: 93%"/></td>
            </tr>
            <tr>
                <td>地区</td>
                <td>
                    <div class="layui-input-inline">
                        <select id="addre_sel" name="addre_sel" lay-verify="required"  class="re_select" style="width: 170px"></select>
                    </div>
                </td>
                <td>部门</td>
                <td>
                    <div class="layui-input-inline">
                        <select id="addde_sel" name="addde_sel" lay-verify="required"  class="de_select" style="width: 170px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td>项目描述</td>
                <td colspan="5"><textarea cols="56" id="addcircular_content"></textarea></td>
            </tr>
            <tr>
                <td>申报方向</td>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="adddtd_sel" name="adddtd_sel" lay-verify="required"  class="adddtd_sel" style="width: 400px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td>申报对象</td>
                <td>
                    <select id="add" style="width: 170px">
                        <option value="">--请选择--</option>
                        <option value="0">个人</option>
                        <option value="1">单位</option>
                    </select>
                </td>
                <td>领域</td>-->
                <td>
                    <!--                    <div class="layui-input-inline">-->
                    <select id="adddo_sel" name="adddo_sel" lay-verify="required"  class="do_select" style="width: 170px"></select>
                    <!--                    </div>-->
                </td>
            </tr>
            <tr>
                <td>支持方式</td>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_way" placeholder="请输入支持方式" style="width: 93%"/></td>
            </tr>
            <tr>
                <td>扶持形式</td>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_gold" placeholder="请输入支持方式" style="width: 93%"/></td>
            </tr>
            <tr>
                <td>扶持金额</td>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_goMoney" placeholder="请输入支持方式" style="width: 93%"/></td>
            </tr>

            <!--            <tr>-->
            <!--                <td>-->
            <!--                <div class="demoTable2">-->
            <!--                    注册时间:-->
            <!--                    <div class="layui-inline" id="time">-->
            <!--                        <div class="layui-input-inline">-->
            <!--                            <input type="text" autocomplete="off" name="id" id="additem_createTime" class="layui-input" placeholder="开始时间">-->
            <!--                        </div>-->
            <!--                        至-->
            <!--                        <div class="layui-input-inline">-->
            <!--                            <input type="text" autocomplete="off" name="id" id="additem_finishTime" class="layui-input" placeholder="结束时间">-->
            <!--                        </div>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--                </td>-->
            <!--            </tr>-->

            <tr>
                <td>处理条件</td>
                <td colspan="5"><textarea cols="56" id="additem_condition"></textarea></td>
            </tr>
            <tr>
                <td>申报单位要求</td>
                <td colspan="5"><textarea cols="56" id="additem_ask"></textarea></td>
            </tr>
            <tr>
                <td>项目申报要求</td>
                <td colspan="5"><textarea cols="56" id="additem_askItem"></textarea></td>
            </tr>
            <tr>
                <td>政策依据</td>
                <td colspan="5"><textarea cols="56" id="additem_policy"></textarea></td>
            </tr>
            <tr>
                <td colspan="5"><input type="file"  style="width: 90%"/></td>
            </tr>
            <hr>
            <tr>
                <td>
                    申报指南: <td colspan="5"><input type="file"  style="width: 90%"/></td>
                </td>
            </tr>
            <tr>
                <td>
                    管理办法: <td colspan="5"><input type="file"  style="width: 90%"/></td>
                </td>
            </tr>

            <tr>
                <td>咨询方式</td>
                <td>
                    <div class="layui-input-inline">
                        <select id="addre_sel2" name="addre_sel2" lay-verify="required"  class="re_select2" style="width: 170px"></select>
                        <input class="layui-layer-input" type="text" id="additem_gd" placeholder="请输入联系人" style="width: 93%"/>
                        <input class="layui-layer-input" type="text" id="additem_gld" placeholder="请输入电话号" style="width: 93%"/>
                    </div>
                </td>
            </tr>
            <tr>
                <th colspan="5"><a style="color: blue">+新建咨询方式</a></th>
            </tr>
            <tr>
                <th>附件</th>
                <td colspan="5"><input type="file"  style="width: 90%"/></td>
            </tr>
            <tr>
                <td rowspan="2"  colspan="5" align="center">
                    <button class="button1" onclick="addsub()">提交</button>
                    <button class="button2" onclick="cancel()">取消</button>
                </td>
            </tr>
        </table>
    </form>
</div>

<script>

    layui.use('form',function(){
        var $ = layui.jquery
        var form = layui.form
//地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addre_sel").empty();
                    $("#addre_sel").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#addre_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addre_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addre_select");
            }
        });
//领域
        $.ajax({
            url: '/selDo',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddo_sel").empty();
                    $("#adddo_sel").append(new Option("请选择领域", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.domoinName
                        $('#adddo_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddo_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddo_select");
            }
        });
//部门
        $.ajax({
            url: '/selDe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addde_sel").empty();
                    $("#addde_sel").append(new Option("请选择部门", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.departmentName
                        $('#addde_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addde_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addde_select");
            }
        });
//级别
        $.ajax({
            url: '/selRa',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addra_sel").empty();
                    $("#addra_sel").append(new Option("请选择级别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.rankName
                        $('#addra_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addra_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addra_select");
            }
        });

// 项目
        $.ajax({
            url: '/selDtd',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addci_sel").empty();
                    $("#addci_sel").append(new Option("请选择项目", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.projectName
                        $('#addci_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addci_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addci_select");
            }
        });
        // });

//申报方向
        $.ajax({
            url: '/selDtd',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddtd_sel").empty();
                    $("#adddtd_sel").append(new Option("请选择申报方向", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.items_dtdName
                        $('#adddtd_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddtd_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddtd_sel");
            }
        });

//咨询方式地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addre_sel2").empty();
                    $("#addre_sel2").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#addre_sel2').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addre_sel2").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addre_select2");
            }
        });





















//修改地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#re_sel").empty();
                    $("#re_sel").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#re_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#re_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("re_select");
            }
        });
//修改领域
        $.ajax({
            url: '/selDo',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#do_sel").empty();
                    $("#do_sel").append(new Option("请选择领域", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.domoinName
                        $('#do_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#do_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("do_select");
            }
        });
//修改部门
        $.ajax({
            url: '/selDe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#de_sel").empty();
                    $("#de_sel").append(new Option("请选择部门", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.departmentName
                        $('#de_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#de_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("de_select");
            }
        });
        //级别
        $.ajax({
            url: '/selRa',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#ra_sel").empty();
                    $("#ra_sel").append(new Option("请选择级别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.rankName
                        $('#ra_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#ra_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("ra_select");
            }
        });

// 修改项目
        $.ajax({
            url: '/selCi',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#ci_sel").empty();
                    $("#ci_sel").append(new Option("请选择项目", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.projectName
                        $('#ci_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#ci_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("ci_select");
            }
        });
    });
</script>
</body>
</html>